package com.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.UserDAO;
import com.entity.User;

@Service("VIPService")
public class VIPServiceImpl implements VIPService {

	@Resource(name = "userDAO")
	private UserDAO dao;

	public List<User> findAllVIP() {
		return dao.findAllVIP();
	}

	public void deleteVip(String userCode) {
		dao.deleteByUserCode(userCode);
	}

	public List<User> findVIPByPage(String page) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("page", Integer.parseInt(page));
		map.put("size", 12);
		map.put("role", "youk");

		return dao.findByPage(map);
	}

	public Integer queryPageCount(String userRole, int size) {
		Integer userNum = dao.queryUserCount(userRole);
		int pageNum = 1 + (userNum / size);
		return pageNum;
	}

}
